package org.jeecg.modules.demo.crm.glm.util;

import java.io.File;
import java.io.FileInputStream;
import java.util.Base64;

public class FileUtils {
    public static String encodeFileToBase64(String filePath) throws Exception {
        File file = new File(filePath);
        FileInputStream fileInputStream = new FileInputStream(file);
        byte[] fileBytes = new byte[(int) file.length()];
        fileInputStream.read(fileBytes);
        fileInputStream.close();
        return Base64.getEncoder().encodeToString(fileBytes);
    }
}